<?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'category-form',
        'enableAjaxValidation' => false,
        'enableClientValidation' => true,
        'htmlOptions' => array(
            'class' => 'form-horizontal',
             'enctype' => 'multipart/form-data'
        ),
    ));
?>
<div class="row-fluid">
    <div class="span12">
        <div class="control-group" style="margin-top: 25px; color: red; font-weight: bold">
            <label for="Ticket_ticket_code" class="control-label"  >TYPE NORMAL</label>    
        </div>
        <!--PAGE CONTENT BEGINS-->
<!--        <div class="control-group">
            <?php echo $form->labelEx($model, 'ticket_code', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'ticket_code[]', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Ticket code')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'ticket_code[]'); ?></span>
            </div>
        </div>-->
<!--        <div class="control-group">
            <?php echo $form->labelex($model, 'type_of_ticket', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'type_of_ticket[]', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Tick Type: A, B, C, Main view')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'type_of_ticket[]'); ?></span>
            </div>
        </div>-->
        
        <div class="control-group">
            <?php echo $form->labelex($model, 'description_of_ticket', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'description_of_ticket[]', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Description Of Ticket')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'description_of_ticket[]'); ?></span>
            </div>
        </div>
        
        <div class="control-group">
            <?php echo $form->labelex($model, 'price', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'price[]', array('size' => 60, 'maxlength' => 255, 'value'=>'0', 'class' => 'price', 'placeholder' => 'Price')); ?> / VNĐ
                <span class="help-inline"><?php echo $form->error($model, 'price[]'); ?></span>
            </div>
        </div>

        <div class="control-group">
            <?php echo $form->labelex($model, 'quantity', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'quantity[]', array('size' => 60, 'maxlength' => 255, 'value'=>'0', 'class' => 'span5 quantity', 'placeholder' => 'Total')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'quantity[]'); ?></span>
            </div>
        </div>
<!--        <div class="control-group">
            <?php echo $form->labelex($model, 'event_id', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->dropDownlist($model, 'event_id[]', MyFunctionCustom::getEventTicket(),array('class' => 'span5', 'placeholder' => 'Event')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'event_id'); ?></span>
            </div>
        </div>-->
        <div class="control-group">
            <?php echo $form->labelex($model, 'ticket_code_org', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'ticket_code_org[]', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Ticket Code Org')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'ticket_code_org[]'); ?></span>
            </div>
        </div>
        <div class="control-group">
            <?php echo $form->labelex($model, 'seat_map', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->dropDownlist($model, 'seat_map[]', array(0=>'No', 1=>'Yes'),array('class' => 'span5','id'=>'seat1', 'placeholder' => 'Seat Map')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'seat_map'); ?></span>
            </div>
        </div>    

        <div class="control-group file1 hide1">
            <?php echo $form->labelex($model, 'fileImage', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->fileField($model, 'fileImage[]', array('class' => 'id-input-file-1 span5')); ?>
                <span class="help-inline" style="float:left;margin-left:390px;"><?php echo $form->error($model, 'fileImage'); ?></span>
            </div>
        </div>
    <!--</div>-->
    <div class="control-group" style="margin-top: 25px; color: red; font-weight: bold">
        <label for="Ticket_ticket_code" class="control-label"  >TYPE GOLD</label>    
    </div>
    
    <!--<div class="span12">-->
        <!--PAGE CONTENT BEGINS-->
<!--        <div class="control-group">
            <?php echo $form->labelEx($model, 'ticket_code', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'ticket_code[]', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Ticket code')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'ticket_code[]'); ?></span>
            </div>
        </div>-->
<!--        <div class="control-group">
            <?php echo $form->labelex($model, 'type_of_ticket', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'type_of_ticket[]', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Tick Type: A, B, C, Main view')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'type_of_ticket[]'); ?></span>
            </div>
        </div>-->
        
        <div class="control-group">
            <?php echo $form->labelex($model, 'description_of_ticket', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'description_of_ticket[]', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Description Of Ticket')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'description_of_ticket[]'); ?></span>
            </div>
        </div>
        
        <div class="control-group">
            <?php echo $form->labelex($model, 'ticket_code_org', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'ticket_code_org[]', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Ticket Code Org')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'ticket_code_org[]'); ?></span>
            </div>
        </div>

        <div class="control-group">
            <?php echo $form->labelex($model, 'price', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'price[]', array('size' => 60, 'maxlength' => 255,'value'=>'0', 'class' => 'price', 'placeholder' => 'Price')); ?> / VNĐ
                <span class="help-inline"><?php echo $form->error($model, 'price[]'); ?></span>
            </div>
        </div>

        <div class="control-group">
            <?php echo $form->labelex($model, 'quantity', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'quantity[]', array('size' => 60, 'maxlength' => 255,'value'=>'0', 'class' => 'span5 quantity', 'placeholder' => 'Total')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'quantity[]'); ?></span>
            </div>
        </div>
<!--        <div class="control-group">
            <?php echo $form->labelex($model, 'event_id', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->dropDownlist($model, 'event_id[]', MyFunctionCustom::getEventTicket(),array('class' => 'span5', 'placeholder' => 'Event')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'event_id'); ?></span>
            </div>
        </div>-->

        
        <div class="control-group">
            <?php echo $form->labelex($model, 'seat_map', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->dropDownlist($model, 'seat_map[]', array(0=>'No', 1=>'Yes'),array('class' => 'span5', 'id'=>'seat2', 'placeholder' => 'Seat Map')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'seat_map'); ?></span>
            </div>
        </div>   

        <div class="control-group file2 hide2">
            <?php echo $form->labelex($model, 'fileImage', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->fileField($model, 'fileImage[]', array('class' => 'id-input-file-1 span5')); ?>
                <span class="help-inline" style="float:left;margin-left:390px;"><?php echo $form->error($model, 'fileImage'); ?></span>
            </div>
        </div>
    <!--</div>-->
    
    <div class="control-group" style="margin-top: 25px; color: red; font-weight: bold">
        <label for="Ticket_ticket_code" class="control-label"  >TYPE LUXURY</label>    
    </div>
    <!--<div class="span12">-->
        <!--PAGE CONTENT BEGINS-->
<!--        <div class="control-group">
            <?php echo $form->labelEx($model, 'ticket_code', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'ticket_code[]', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Ticket code')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'ticket_code[]'); ?></span>
            </div>
        </div>-->
<!--        <div class="control-group">
            <?php echo $form->labelex($model, 'type_of_ticket', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'type_of_ticket[]', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Tick Type: A, B, C, Main view')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'type_of_ticket[]'); ?></span>
            </div>
        </div>-->
        
        <div class="control-group">
            <?php echo $form->labelex($model, 'description_of_ticket', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'description_of_ticket[]', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Description Of Ticket')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'description_of_ticket[]'); ?></span>
            </div>
        </div>
        
        <div class="control-group">
            <?php echo $form->labelex($model, 'price', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'price[]', array('size' => 60, 'maxlength' => 255, 'value'=>'0','class' => 'price', 'placeholder' => 'Price')); ?> / VNĐ
                <span class="help-inline"><?php echo $form->error($model, 'price[]'); ?></span>
            </div>
        </div>

        <div class="control-group">
            <?php echo $form->labelex($model, 'quantity', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'quantity[]', array('size' => 60, 'maxlength' => 255, 'value'=>'0','class' => 'span5 quantity', 'placeholder' => 'Total')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'quantity[]'); ?></span>
            </div>
        </div>
<!--        <div class="control-group">
            <?php echo $form->labelex($model, 'event_id', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->dropDownlist($model, 'event_id[]', MyFunctionCustom::getEventTicket(),array('class' => 'span5', 'placeholder' => 'Event')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'event_id'); ?></span>
            </div>
        </div>-->
        <div class="control-group">
            <?php echo $form->labelex($model, 'ticket_code_org', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->textField($model, 'ticket_code_org[]', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Ticket Code Org')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'ticket_code_org[]'); ?></span>
            </div>
        </div>

        <div class="control-group">
            <?php echo $form->labelex($model, 'seat_map', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->dropDownlist($model, 'seat_map[]', array(0=>'No', 1=>'Yes'),array('class' => 'span5', 'id'=>'seat3',  'placeholder' => 'Seat Map')); ?>
                <span class="help-inline"><?php echo $form->error($model, 'seat_map'); ?></span>
            </div>
        </div>   

        <div class="control-group file3 hide3">
            <?php echo $form->labelex($model, 'fileImage', array('class' => 'control-label')); ?>
            <div class="controls">
                <?php echo $form->fileField($model, 'fileImage[]', array('class' => 'id-input-file-1 span5')); ?>
                <span class="help-inline" style="float:left;margin-left:390px;"><?php echo $form->error($model, 'fileImage'); ?></span>
            </div>
        </div>
    </div>
    <div class="form-actions">
        <button class="btn btn-info" type="submit">
            <i class="icon-ok bigger-110"></i>
            Submit
        </button>
        &nbsp; &nbsp; &nbsp;
        <button class="btn" type="reset">
            <i class="icon-undo bigger-110"></i>
            Reset
        </button>
    </div>    
</div>
<?php $this->endWidget(); ?>

<script>
    
    $('#seat1').live('change', function(){
        var a = $(this).val();
        if (a === '1') {
            $('.file1').removeClass('hide1');
        }
    });
    $('#seat2').live('change', function(){
        var a = $(this).val();
        if (a === '1') {
            $('.file2').removeClass('hide2');
        }
    });
    $('#seat3').live('change', function(){
        var a = $(this).val();
        if (a === '1') {
            $('.file3').removeClass('hide3');
        }
    });
    
    
    
//    function validateNumber(){
            $(".price").live('click', function(){
                    $(this).unbind("keydown");
                    $(this).bind("keydown",function(event){
                        if( !(event.keyCode == 8                                // backspace
                            || event.keyCode == 46                              // delete
                            || event.keyCode == null                      // delete
                            || event.keyCode == 9							// tab
                            || (event.keyCode == 190 || event.keyCode == 110 )							// dấu chấm (point) 
                            || (event.keyCode >= 35 && event.keyCode <= 40)     // arrow keys/home/end
                            || (event.keyCode >= 48 && event.keyCode <= 57)     // numbers on keyboard
                            || (event.keyCode >= 96 && event.keyCode <= 105))   // number on keypad
                            ) {
                                event.preventDefault();     // Prevent character input
                            }
                    });
            });
            
            $(".quantity").live('click', function(){
                    $(this).unbind("keydown");
                    $(this).bind("keydown",function(event){
                        if( !(event.keyCode == 8                                // backspace
                            || event.keyCode == 46                              // delete
                            || event.keyCode == null                      // delete
                            || event.keyCode == 9							// tab
//                            || (event.keyCode == 190 || event.keyCode == 110 )							// dấu chấm (point) 
                            || (event.keyCode >= 35 && event.keyCode <= 40)     // arrow keys/home/end
                            || (event.keyCode >= 48 && event.keyCode <= 57)     // numbers on keyboard
                            || (event.keyCode >= 96 && event.keyCode <= 105))   // number on keypad
                            ) {
                                event.preventDefault();     // Prevent character input
                            }
                    });
            });
//    }
</script>

<style>
    .price{
        width: 363px;
    }
    
    .ace-file-input {
        width: 378px;
    } 
    
    .hide1, .hide2, .hide3{
        display: none;
    }
</style>